package com.jiepos.mpos.biz.channel.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;

import com.jiepos.mpos.biz.channel.service.InfChannelGrpService;
import com.jiepos.mpos.common.entity.App_Inf_channel_GrpEntity;
import com.jiepos.mpos.core.controller.BaseController;
import com.jiepos.mpos.core.entity.Pagination;

/**
 * 
 * 
 * <p>标题: —— 通道组别表控制器</p>
 * <p>模块: 通用平台</p>
 * <p>版权: Copyright (c) 2017 江苏杰博实信息技术有限公司
 * @ProjectName:  [mpos] 
 * @Package com.jiepos.mpos.biz.channel.controller 
 * @author 张学涛
 * @version 1.0
 * @since 2017年9月20日上午11:16:30
 * @history（历次修订内容、修订人、修订时间等）
 */
@Controller
@RequestMapping("channelgrp")
public class InfChannelGrpController extends BaseController {
	
	@Autowired
	private InfChannelGrpService infChannelGrpService;
	
	
	/**
	 * 进入通道组别信息列表页面
	 * @param request
	 * @param response
	 * @param pagination
	 * @return
	 */
	@RequestMapping("/getChannelGrpList.do")
	public ModelAndView getChannelGrpList(HttpServletRequest request,HttpServletResponse response,Pagination pagination){
		ModelAndView model=new ModelAndView("/module/channel/channelgrp/channelgrp_list");
		return super.getDetail(request, response, model);
	}
	
	/**
	 * 查询通道组别列表信息json数据
	 * @param pagination
	 * @param infChannelGrpEntity
	 * @return
	 */
	@RequestMapping("/getChannelGrpListJson.do")
	public @ResponseBody Map getChannelGrpListJson(Pagination pagination,App_Inf_channel_GrpEntity infChannelGrpEntity){
		return infChannelGrpService.getChannelGrpList(pagination, infChannelGrpEntity);
	}
	
	/**
	 * 进入通道组别信息详细页面
	 * @param request
	 * @param response
	 * @param pagination
	 * @param channel_grp_uuid
	 * @return
	 */
	@RequestMapping("/getChannelGrpDetail.do")
	public ModelAndView getChannelGrpDetail(HttpServletRequest request, HttpServletResponse response,
			Pagination pagination,String channel_grp_uuid){
		ModelAndView model=new ModelAndView("/module/channel/channelgrp/channelgrp_detail");
		App_Inf_channel_GrpEntity infChannelGrp=infChannelGrpService.getChannelGrpById(channel_grp_uuid);
		model.addObject("infChannelGrp", infChannelGrp);
		return super.getDetail(request, response, model);
	}
	
	/**
	 * 保存通道组别
	 * @param request
	 * @param response
	 * @param infChannelGrpEntity
	 * @return
	 */
	@RequestMapping("/saveChannelGrp.do")
	public ModelAndView saveChannelGrp(HttpServletRequest request, HttpServletResponse response,App_Inf_channel_GrpEntity infChannelGrpEntity){
		infChannelGrpService.saveChannelGrp(infChannelGrpEntity, super.getLoginUser(request, response));
		Map map=super.getLoginUser(request, response);  
		return new ModelAndView(new RedirectView("getChannelGrpList.do"), map);
	}
	
	/**
	 * 删除通道组别
	 * @param request
	 * @param response
	 * @param channel_grp_uuids
	 * @return
	 */
	@RequestMapping("/deleteChannelGrpByIds.do")
	public ModelAndView deleteChannelGrpByIds(HttpServletRequest request, HttpServletResponse response,String channel_grp_uuids){
		infChannelGrpService.deleteChannelGrpByIds(channel_grp_uuids);
		Map map=super.getLoginUser(request, response);  
		return new ModelAndView(new RedirectView("getChannelGrpList.do"), map);
	}
	
	
	/**
	 * 校验通道组别
	 * @param infChannelGrpEntity
	 * @return
	 */
	@RequestMapping("/checkChannelGrp.do")
	public @ResponseBody String checkChannelGrp(App_Inf_channel_GrpEntity infChannelGrpEntity){		
		return infChannelGrpService.checkChannelGrp(infChannelGrpEntity);
	}

}
